
class SpeedUnit {
	public String name;
	public double rate=1 // rate to meter/second
	public double rateFrom=1 // rate from meter/second
	
	static SpeedUnit MPH = new SpeedUnit(name:'mph',     rate:0.44704, 		rateFrom:2.23693629);
	static SpeedUnit KPH = new SpeedUnit(name:'kph',     rate:0.27777778,	rateFrom:3.6);
	static SpeedUnit KNOTS = new SpeedUnit(name:'knots', rate:0.51444444,	rateFrom:1.94384451);
	static SpeedUnit MS = new SpeedUnit(name:'ms',rate:1,rateFrom:1);
	
	
	
	static SpeedUnit getInstance(String name){
		switch(name){
		case 'mph': return MPH
		case 'kph': return KPH
		case 'knots':return KNOTS
		default: return MS
		}
	}
}